<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>服务处理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:100%;" id="dataFrm">
    <div class="layui-form-item layui-row layui-col-xs12" >
        <label class="layui-form-label">编号:</label>
        <div class="layui-input-block ">
            <input type="text" class="layui-input id" name="id" lay-verify="required" readonly="readonly" style="width: 100px" >
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">服务类型:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input type" name="type" lay-verify="required" readonly="readonly" style="width: 100px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">概要:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input outline" name="outline" lay-verify="required" readonly="readonly" style="width: 600px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">状态:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input conditions" name="conditions" lay-verify="required" value="已处理" readonly="readonly" style="width: 100px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">客户:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input client" name="client" lay-verify="required" readonly="readonly" style="width: 100px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">服务请求:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input request" name="requst" lay-verify="required" readonly="readonly" style="width: 600px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">创建人:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input founder" name="fouder" lay-verify="required"  readonly="readonly" style="width: 100px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">创建时间:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input creatTime" name="creatTime" lay-verify="required" readonly="readonly" style="width: 200px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">分配给:</label>
        <div class="layui-input-block " >
            <input type="text" class="layui-input assignee " name="assignee" lay-verify="required"  readonly="readonly" style="width: 100px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">分配时间:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input distributeTime" name="distributeTime" lay-verify="required" readonly="readonly" style="width: 200px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">服务处理:</label>
        <div class="layui-input-block">
            <textarea cols="80" rows="10 " name="serviceDeal" id="serviceDeal"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">处理人：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input conductor" lay-verify="required" name="conductor" id="conductor" style="width: 100px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">处理时间:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input dealTime" lay-verify="required" name="dealTime" placeholder="请确定处理时间" id="dealTime" style="width: 200px">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <input type="hidden" id="serviceIdHiden"></input>
            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="addDeal">立即处理</button>
            <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="resources/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;

        layui.use('laydate', function() {
            var laydate = layui.laydate;
            var now = new Date();
            laydate.render({
                elem: '#dealTime',
                theme: 'molv',
                format:'yyyy-MM-dd HH:mm:ss',
                type: 'datetime',
                trigger: 'click',
                max:4073558400000, //公元3000年1月1日
                ready: function(date){
                    //console.log(date); //得到初始的日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
                    this.dateTime.hours=now.getHours();
                    this.dateTime.minutes=now.getMinutes();
                    this.dateTime.seconds=now.getSeconds();
                }

            });
        });
        //请求获取数据
        form.on("submit(addDeal)", function (data) {
            var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.4});
            var id=$('#serviceIdHiden').val();
            var de=$('#serviceDeal').val();
            var ct=$('#conductor').val();
            var time=$('#dealTime').val();
            $.post("/service/updatDeal.do", {id:id, serviceDeal:de, conductor:ct,dealTime:time}, function (res) {
                console.log(res)
                if (res.code == 200) {
                    setTimeout(function () {
                        top.layer.close(index);
                        top.layer.msg("处理成功！");
                        //刷新父页面
                        parent.location.reload();
                    }, 2000)
                }
            }, "json");
            return false;
        });
    })
</script>
</body>
</html>